package com.ease.core.components {
   import com.ease.core.events.DockingEvent;
   import com.ease.component.IconButton;
   import com.ease.core.components.DockableToolBar;

   import flash.events.MouseEvent;
   import com.ease.component.IconButton;

   public class FastViewBar extends DockableToolBar {
      [Embed(source="/assets/icon/restore.gif")]
      protected var restoreIconClass:Class;

      public var viewWindow:ViewWindow;

      public var stageWindow:StageWindow;

      private var restoreButton:IconButton;
      public var isMaximizing:Boolean = false;

      public function FastViewBar() {
         super();

         styleName = "fastViewBar";
      }

      override protected function createChildren():void {
         if (!restoreButton) {
            restoreButton = new IconButton();
            restoreButton.toolTip = "恢复";
            restoreButton.setStyle("icon", restoreIconClass);
            restoreButton.addEventListener(MouseEvent.CLICK, onRestore);
         }
         this.addChildAt(restoreButton, 0);

         super.createChildren();
      }

      private function onRestore(event:MouseEvent):void {
         stageWindow.fireRestoreViewWindow(viewWindow);
         if (this.parent) {
            this.parent.removeChild(this);
         }
      }
   }
}